package com.itserver.service.sys.impl;

import com.itserver.mapper.sys.PostMapper;
import com.itserver.pojo.PageResult;
import com.itserver.pojo.sys.Post;
import com.itserver.service.sys.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PostServiceImpl  implements PostService {
    //注入
    @Autowired
    private  PostMapper postMapper;

    @Override
    public PageResult<Post> list() {
        List<Post> list = postMapper.list();
        return new PageResult<>((long) list.size(), list);

    }

    @Override
    public void add(Post post) {
        postMapper.add(post);
    }

    @Override
    public void update(Post post) {
        postMapper.update(post);
    }

    @Override
    public void delete(List<Integer> ids) {
        postMapper.delete(ids);
    }

    @Override
    public Post getById(Integer id) {
       return postMapper.getById(id);
    }

}
